<template>
  <Layout>
    <router-view v-slot="{ Component }">
      <!-- <transition name="fade" mode="out-in"> -->
      <keep-alive :include="KeepAliveInclude" :exclude="KeepAliveExcludes">
        <component :is="Component" :key="key" />
      </keep-alive>
      <!-- </transition> -->
    </router-view>
  </Layout>
</template>

<script setup>
import Layout from '../layout/index.vue'
import { getCurrentInstance, ref, computed } from 'vue'
import { useRouter } from 'vue-router'
import { KeepAliveInclude, KeepAliveExcludes } from '@/units'
const router = useRouter()

const key = computed(() => router.currentRoute.value.path)
</script>

<style scoped>
.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
.fade-enter-to,
.fade-leave-from {
  opacity: 1;
}

.fade-enter-active,
.fade-leave-active {
  transition: all 0.5s ease-out;
}
</style>
